//
// Created by 王乐 on 2022/2/9.
//

#include "LeBackGroundGameObject.h"
#include "LeQuadRenderer.h"

LeBackGroundGameObject::LeBackGroundGameObject()
{

}

LeBackGroundGameObject::~LeBackGroundGameObject()
{

}

void LeBackGroundGameObject::Initialize()
{
    strName = "MyBackGround";

    // Transform
    // ---------
    m_Transform.setPosition(m_Position.x, m_Position.y, m_Position.z);
    m_Transform.setScale(m_Scale.x, m_Scale.y, m_Scale.z);

    // Renderer
    // --------
    LeQuadRenderer* pRenderer = new LeQuadRenderer();
    pRenderer->initRenderer(this, m_VertexShaderPath, m_FragmentShaderPath);
    pRenderer->addSprite(m_SpritePath);

    // Initialize Components
    initComponents(pRenderer, nullptr, nullptr, nullptr);
}

void LeBackGroundGameObject::InitializeBackGroundGameObject(const glm::vec3 &pos, const glm::vec3 &scal,
                                                            const char *vertexshaderpath,
                                                            const char *fragmentshaderpath, const char *spritepath)
{
    m_Position = pos;
    m_Scale = scal;
    m_VertexShaderPath = vertexshaderpath;
    m_FragmentShaderPath = fragmentshaderpath;
    m_SpritePath = spritepath;
}
